//package com.palm.hubo2o.ui;
//
//import android.os.Bundle;
//import android.support.design.widget.TabLayout;
//import android.support.v4.app.FragmentManager;
//import android.view.MenuItem;
//
//import com.palm.hubo2o.BaseActivity;
//import com.palm.hubo2o.R;
//import com.palm.hubo2o.util.Constant;
//
//import butterknife.Bind;
//
///**
// * Created by dest1 on 2015/11/3.
// */
//public class D3TrendActivity extends BaseActivity implements TabLayout.OnTabSelectedListener {
//    @Bind(R.id.tab_trend_ssq)
//    TabLayout mTabLayout;
//    private FragmentManager manager;
//    private TrendFragment hFragment;
//    private TrendFragment tFragment;
//    private TrendFragment bFragment;
//    private String mCurrentTag;
//    private final String[] tags = {"h", "t", "b"};
//
//    @Override
//    protected void onCreate(Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_trend_d3);
//        changeWindowColor(getColorRGB(R.color.headerTextColor));
//        manager = getSupportFragmentManager();
//        mTabLayout.addTab(mTabLayout.newTab().setText("百位"), true);
//        mTabLayout.addTab(mTabLayout.newTab().setText("十位"));
//        mTabLayout.addTab(mTabLayout.newTab().setText("个位"));
//        mTabLayout.setOnTabSelectedListener(this);
//        onTabSelected(mTabLayout.getTabAt(0));
//    }
//
//    @Override
//    public void onTabSelected(TabLayout.Tab tab) {
//        int pos = tab.getPosition();
//        switch (pos) {
//            case 0:
//                if (hFragment == null) {
//                    hFragment = new TrendFragment();
//                    hFragment.ifFromZero(true);
//                    hFragment.ifNeedLink(true);
//                    hFragment.setMarkColor(getColorRGB(R.color.pink));
//                    hFragment.setTrendInfo(Constant.LOTTERY_D3, "HUNDRED_OMIT");
//                    manager.beginTransaction().add(R.id.container_trend_d3, hFragment, tags[pos]).
//                            commit();
//                } else
//                    manager.beginTransaction().hide(manager.findFragmentByTag(mCurrentTag)).show(hFragment).commit();
//
//                break;
//            case 1:
//                if (tFragment == null) {
//                    tFragment = new TrendFragment();
//                    tFragment.ifFromZero(true);
//                    tFragment.ifNeedLink(true);
//                    tFragment.setMarkColor(getColorRGB(R.color.orange));
//                    tFragment.setTrendInfo(Constant.LOTTERY_D3, "TENS_OMIT");
//                    manager.beginTransaction().hide(manager.findFragmentByTag(mCurrentTag)).add(R.id.container_trend_d3, tFragment, tags[pos]).commit();
//                } else
//                    manager.beginTransaction().hide(manager.findFragmentByTag(mCurrentTag)).show(tFragment).commit();
//                break;
//            case 2:
//                if (bFragment == null) {
//                    bFragment = new TrendFragment();
//                    bFragment.ifFromZero(true);
//                    bFragment.ifNeedLink(true);
//                    bFragment.setMarkColor(getColorRGB(R.color.green));
//                    bFragment.setTrendInfo(Constant.LOTTERY_D3, "UNIT_OMIT");
//                    manager.beginTransaction().hide(manager.findFragmentByTag(mCurrentTag)).add(R.id.container_trend_d3, bFragment, tags[pos]).commit();
//                } else
//                    manager.beginTransaction().hide(manager.findFragmentByTag(mCurrentTag)).show(bFragment).commit();
//                break;
//            default:
//                break;
//        }
//        mCurrentTag = tags[pos];
//    }
//
//    @Override
//    public void onTabUnselected(TabLayout.Tab tab) {
//
//    }
//
//    @Override
//    public void onTabReselected(TabLayout.Tab tab) {
//
//    }
//
//    @Override
//    public boolean onOptionsItemSelected(MenuItem item) {
//        if (item.getItemId() == android.R.id.home) {
//            finish();
//            return true;
//        }
//        return super.onOptionsItemSelected(item);
//    }
//}
